package com.zjzywl.smoke.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zjzywl.smoke.entity.DeviceStatus;
import com.zjzywl.smoke.repository.DeviceStatusRepository;
import com.zjzywl.smoke.service.DeviceStatusService;

@Service
public class DeviceStatusServiceImpl implements DeviceStatusService {
	@Autowired
	private DeviceStatusRepository deviceStatusRepository;

	@Override
	public List getDSByUserAndDeviceType(String userId, String devicetypeId, String status, String devCode) {

		List dss = deviceStatusRepository.getDSByUserAndDeviceType(userId, devicetypeId, status, devCode);
		return dss;
	}

	@Override
	public DeviceStatus findByDevCode(String devCode) {
		DeviceStatus findByDevCode = deviceStatusRepository.findByDevCode(devCode);
		return findByDevCode;
	}

	@Override
	public void deleteByDevCode(String devCode) {
		deviceStatusRepository.deleteByDevCode(devCode);
	}

	@Override
	public void save(DeviceStatus ds) {
		deviceStatusRepository.save(ds);
	}
	@Override
	public List<DeviceStatus> getDeviceByPosition(double minlat, double maxlat, double minlng, double maxlng) {
		List<DeviceStatus> devices=deviceStatusRepository.getDeviceByPosition(minlat,maxlat,minlng,maxlng);
		return devices;
	}
}
